x86: handle paged gfn in wrmsr_hypervisor_regs
authorOlaf Hering <olaf@aepfle.de>
Tue, 7 May 2013 14:41:24 +0000 (16:41 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 7 May 2013 14:41:24 +0000 (16:41 +0200)
commit013e34f5a61725012467f17650597d351fc0ca99
tree594b4e26937725656d6b6ff45b307bb770eaaae1
parentda3ef0f81250b5a680001610028ff35ee94741bc
x86: handle paged gfn in wrmsr_hypervisor_regs

If xenpaging is started very early for a guest the gfn for the hypercall
page may be paged-out already. This leads to a guest crash:

...
(XEN) HVM10: Allocated Xen hypercall page at 169ff000
(XEN) traps.c:654:d10 Bad GMFN 169ff (MFN 3e900000000) to MSR 40000000
(XEN) HVM10: Detected Xen v4.3
(XEN) io.c:201:d10 MMIO emulation failed @ 0008:c2c2c2c2: 18 7c 55 6d 03 83 ff ff 10 7c
(XEN) hvm.c:1253:d10 Triple fault on VCPU0 - invoking HVM shutdown action 1.
(XEN) HVM11: HVM Loader
...

Update return codes of wrmsr_hypervisor_regs, update callers to deal
with the new return codes:
 0: not handled
 1: handled
 -EAGAIN: retry

Currently wrmsr_hypervisor_regs will not return the following error, it
will be added in a separate patch:
 -EINVAL: error during handling

Also update the gdprintk to handle a page value of NULL to avoid
printing a bogus MFN value. Update also computing of MSR value in
gdprintk, the idx was always zero.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Keir Fraser <keir@xen.org>
xen/arch/x86/hvm/svm/svm.c
xen/arch/x86/hvm/vmx/vmx.c
xen/arch/x86/traps.c